<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .active {
            color: red;
            background-color: royalblue;
        }
    </style>
</head>

<body>
    <div id="app">
        <table>
            <!-- 唯一的对象，需要用这个写法接收index -->
            <tr v-for="(ob,key,index) in obj">
                <td>{{ob}}</td>
                <td>{{key}}</td>
                <td>{{index}}</td>
            </tr>
        </table>
        <div v-for="(val,index) in arr">
            <p :class={active:val.statr} @click="val.statr=!val.statr">{{val.name}}</p>
        </div>
        <div v-for="(val,index) in arr">
            <span v-if="val.statr" @click="cli(index)">{{val.name}}</span>
        </div> 

    </div>

    <div id="app1">
        <!-- keyup是抬起的时候触发 -->
        <input type="text" v-model="text" @keydown.enter="add()">
        <div v-for="message in message">
            <p>{{message}}</p>
        </div>
    </div>
    <script src="./node_modules/vue/dist/vue.js"></script>
    <script src="./js/10-8.js"></script>
</body>

</html>